package com.aha.dataanalyzeandview.config.datasource;

import org.springframework.stereotype.Component;

/******************************
 * Project:           data-analyze-and-view
 * FileName:          OracleQueryMetadataSqlConfig.java
 * ClassName:         OracleQueryMetadataSqlConfig
 * Time:              2020/8/23 10:20
 * Version:           1.00
 * Author:            努力就是魅力
 * Description:       TODO
 ******************************/

public class OracleQueryMetadataSqlConfig {


    public static String showDatabaseSql(){
        return "select * from all_users";
    }


    public static String showTablesSql(String username){
        return String.format("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables\n" +
                "\t\twhere table_schema =  %s ",username);
    }

    public static String queryAllColumnSql(String dbName, String tableName){
        return String.format("select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns\n" +
                " \t\t\twhere table_name = %s and table_schema = %s order by ordinal_position",tableName,dbName);
    }
}
